package com.siki.config;

import io.swagger.models.auth.In;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @Author Siki
 * @Date 2020/4/23
 *
 * @Description 我在这里藏一个Main来刷leetcode应该没有人能发现吧
 */

public class Main {
    public static void main(String[] args) {
        int n = 7;
        int fast = getNext(n);
        int slow = n;
        while(slow!=1&&slow!=fast){
            slow=getNext(slow);
            fast=getNext(getNext(fast));
        }
        System.out.println(fast==1);
    }

    private static int getNext(int n) {
        int returnInt =0;
        while (n>0){
            int d = n%10;
            n/=10;
            returnInt +=d*d;
        }
        return returnInt;
    }
}
